package com.itmg.analyze.jp.url.impl;

import org.apache.log4j.Logger;

import com.itmg.analyze.jp.bean.RakutenAuctionParaBean;
import com.itmg.analyze.jp.model.RakutenAuctionSearchParamModel;
import com.itmg.analyze.jp.url.IURLAnalyze;
import com.itmg.vo.SearchParameterVO;
import com.itmg.vo.TargetDataVO;

/**
 *  获得匹配好的url
 * @author Yunhong chen
 * */

public class RakutenAuctionURlAnlyzeImpl implements IURLAnalyze {
	protected Logger log = Logger.getLogger(RakutenAuctionURlAnlyzeImpl.class.getName());
	private String rootURL = "http://api.rakuten.co.jp/rws/2.0/rest";
	private String developID = "ea4b1478b6a1999ee7a44d2c6f8c6a50";
	private Integer hits = 20;
	private String sourceSiteName = "auction.rakuten.co.jp";
	
	public RakutenAuctionURlAnlyzeImpl() {
	}
	
	public TargetDataVO getURLDataByParameter(SearchParameterVO searchParameterVO) throws Exception {
		RakutenAuctionSearchParamModel rakutenSearchParamModel = RakutenAuctionParaBean.getKakakuAuctionSearchParamModel(searchParameterVO);
		rakutenSearchParamModel.setDeveloperId(developID);
		rakutenSearchParamModel.setOperation("AuctionItemSearch");
		rakutenSearchParamModel.setVersion("2007-12-13");
		
		rakutenSearchParamModel.setHits(hits);
		TargetDataVO targetDataVO = new TargetDataVO();
		targetDataVO.setSourceSiteName(sourceSiteName);
		targetDataVO.setUrl(rootURL+rakutenSearchParamModel.getURLPara());
log.info(targetDataVO.getUrl());
		return targetDataVO;
	}
}
